package org.mikhaylov.cp.service.command.impl;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.mikhaylov.cp.service.command.ServiceCommand;
import org.mikhaylov.cp.service.db.entities.City;
import org.mikhaylov.cp.service.hibernate.HibernateManager;
import org.mikhaylov.cp.service.response.ResponseType;

public class GetCitiesServiceCommand extends ServiceCommand {

	private static final long serialVersionUID = 2895673812218900997L;

	@Override
	protected boolean checkParams(HttpServletRequest request) {
		return true;
	}

	@Override
	protected boolean extractParams(HttpServletRequest request) {
		return true;
	}

	@Override
	protected void process(HttpServletRequest request) {
		response.setType(ResponseType.SUCCESS);
		List<City> cities = HibernateManager.getInstance().getCities();
		
		request.setAttribute("cities", cities);
	}

}
